NOTE: Most of the tests in DIEHARD return a p-value, which should be uniform on [0,1) if the input file contains truly independent random bits. Those p-values are obtained by p=F(X), where F is the assumed distribution of the sample random variable X---often normal. But that assumed F is just an asymptotic approximation, for which the fit will be worst in the tails. Thus you should not be surprised with occasional p-values near 0 or 1, such as .0012 or .9983. When a bit stream really FAILS BIG, you will get p's of 0 or 1 to six or more places. By all means, do not, as a Statistician might, think that a p < .025 or p> .975 means that the RNG has "failed the test at the .05 level". Such p's happen among the hundreds that DIEHARD produces, even with good RNG's. So keep in mind that " p happens". ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the BIRTHDAY SPACINGS TEST :: :: Choose m birthdays in a year of n days. List the spacings :: :: between the birthdays. If j is the number of values that :: :: occur more than once in that list, then j is asymptotically :: :: Poisson distributed with mean m^3/(4n). Experience shows n :: :: must be quite large, say n>=2^18, for comparing the results :: :: to the Poisson distribution with that mean. This test uses :: :: n=2^24 and m=2^9, so that the underlying distribution for j :: :: is taken to be Poisson with lambda=2^27/(2^26)=2. A sample :: :: of 500 j's is taken, and a chi-square goodness of fit test :: :: provides a p value. The first test uses bits 1-24 (counting :: :: from the left) from integers in the specified file. :: :: Then the file is closed and reopened. Next, bits 2-25 are :: :: used to provide birthdays, then 3-26 and so on to bits 9-32. :: :: Each set of bits provides a p-value, and the nine p-values :: :: provide a sample for a KSTEST. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: BIRTHDAY SPACINGS TEST, M= 512 N=2**24 LAMBDA= 2.0000 Results for BKGRBIN For a sample of size 500: mean BKGRBIN using bits 1 to 24 374.124 duplicate number number spacings observed expected 0 500. 67.668 1 0. 135.335 2 0. 135.335 3 0. 90.224 4 0. 45.112 5 0. 18.045 6 to INF 0. 8.282 Chisquare with 6 d.o.f. = 3194.53 p-value= 1.000000 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean BKGRBIN using bits 2 to 25 369.394 duplicate number number spacings observed expected 0 500. 67.668 1 0. 135.335 2 0. 135.335 3 0. 90.224 4 0. 45.112 5 0. 18.045 6 to INF 0. 8.282 Chisquare with 6 d.o.f. = 3194.53 p-value= 1.000000 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean BKGRBIN using bits 3 to 26 365.202 duplicate number number spacings observed expected 0 500. 67.668 1 0. 135.335 2 0. 135.335 3 0. 90.224 4 0. 45.112 5 0. 18.045 6 to INF 0. 8.282 Chisquare with 6 d.o.f. = 3194.53 p-value= 1.000000 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean BKGRBIN using bits 4 to 27 362.470 duplicate number number spacings observed expected 0 500. 67.668 1 0. 135.335 2 0. 135.335 3 0. 90.224 4 0. 45.112 5 0. 18.045 6 to INF 0. 8.282 Chisquare with 6 d.o.f. = 3194.53 p-value= 1.000000 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean BKGRBIN using bits 5 to 28 361.024 duplicate number number spacings observed expected 0 500. 67.668 1 0. 135.335 2 0. 135.335 3 0. 90.224 4 0. 45.112 5 0. 18.045 6 to INF 0. 8.282 Chisquare with 6 d.o.f. = 3194.53 p-value= 1.000000 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean BKGRBIN using bits 6 to 29 359.950 duplicate number number spacings observed expected 0 500. 67.668 1 0. 135.335 2 0. 135.335 3 0. 90.224 4 0. 45.112 5 0. 18.045 6 to INF 0. 8.282 Chisquare with 6 d.o.f. = 3194.53 p-value= 1.000000 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean BKGRBIN using bits 7 to 30 359.144 duplicate number number spacings observed expected 0 500. 67.668 1 0. 135.335 2 0. 135.335 3 0. 90.224 4 0. 45.112 5 0. 18.045 6 to INF 0. 8.282 Chisquare with 6 d.o.f. = 3194.53 p-value= 1.000000 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean BKGRBIN using bits 8 to 31 359.102 duplicate number number spacings observed expected 0 500. 67.668 1 0. 135.335 2 0. 135.335 3 0. 90.224 4 0. 45.112 5 0. 18.045 6 to INF 0. 8.282 Chisquare with 6 d.o.f. = 3194.53 p-value= 1.000000 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean BKGRBIN using bits 9 to 32 359.086 duplicate number number spacings observed expected 0 500. 67.668 1 0. 135.335 2 0. 135.335 3 0. 90.224 4 0. 45.112 5 0. 18.045 6 to INF 0. 8.282 Chisquare with 6 d.o.f. = 3194.53 p-value= 1.000000 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 A KSTEST for the 9 p-values yields 1.000000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: THE OVERLAPPING 5-PERMUTATION TEST :: :: This is the OPERM5 test. It looks at a sequence of one mill- :: :: ion 32-bit random integers. Each set of five consecutive :: :: integers can be in one of 120 states, for the 5! possible or- :: :: derings of five numbers. Thus the 5th, 6th, 7th,...numbers :: :: each provide a state. As many thousands of state transitions :: :: are observed, cumulative counts are made of the number of :: :: occurences of each state. Then the quadratic form in the :: :: weak inverse of the 120x120 covariance matrix yields a test :: :: equivalent to the likelihood ratio test that the 120 cell :: :: counts came from the specified (asymptotically) normal dis- :: :: tribution with the specified 120x120 covariance matrix (with :: :: rank 99). This version uses 1,000,000 integers, twice. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: OPERM5 test for file BKGRBIN For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=*******; p-value=1.000000 OPERM5 test for file BKGRBIN For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=*******; p-value=1.000000 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the BINARY RANK TEST for 31x31 matrices. The leftmost :: :: 31 bits of 31 random integers from the test sequence are used :: :: to form a 31x31 binary matrix over the field {0,1}. The rank :: :: is determined. That rank can be from 0 to 31, but ranks< 28 :: :: are rare, and their counts are pooled with those for rank 28. :: :: Ranks are found for 40,000 such random matrices and a chisqua-:: :: re test is performed on counts for ranks 31,30,29 and <=28. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Binary rank test for BKGRBIN Rank test for 31x31 binary matrices: rows from leftmost 31 bits of each 32-bit integer rank observed expected (o-e)^2/e sum 28 40000 211.4******************* 29 0 5134.0******************* 30 0 23103.0******************* 31 0 11551.5******************* chisquare=****** for 3 d. of f.; p-value=1.000000 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the BINARY RANK TEST for 32x32 matrices. A random 32x :: :: 32 binary matrix is formed, each row a 32-bit random integer. :: :: The rank is determined. That rank can be from 0 to 32, ranks :: :: less than 29 are rare, and their counts are pooled with those :: :: for rank 29. Ranks are found for 40,000 such random matrices :: :: and a chisquare test is performed on counts for ranks 32,31, :: :: 30 and <=29. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Binary rank test for BKGRBIN Rank test for 32x32 binary matrices: rows from leftmost 32 bits of each 32-bit integer rank observed expected (o-e)^2/e sum 29 40000 211.4******************* 30 0 5134.0******************* 31 0 23103.0******************* 32 0 11551.5******************* chisquare=****** for 3 d. of f.; p-value=1.000000 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the BINARY RANK TEST for 6x8 matrices. From each of :: :: six random 32-bit integers from the generator under test, a :: :: specified byte is chosen, and the resulting six bytes form a :: :: 6x8 binary matrix whose rank is determined. That rank can be :: :: from 0 to 6, but ranks 0,1,2,3 are rare; their counts are :: :: pooled with those for rank 4. Ranks are found for 100,000 :: :: random matrices, and a chi-square test is performed on :: :: counts for ranks 6,5 and <=4. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Binary Rank Test for BKGRBIN Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 100000 944.310390790.00010390790.000 r =5 0 21743.9 21743.90010412530.000 r =6 0 77311.8 77311.80010489840.000 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 100000 944.310390790.00010390790.000 r =5 0 21743.9 21743.90010412530.000 r =6 0 77311.8 77311.80010489840.000 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 99968 944.310384070.00010384070.000 r =5 32 21743.9 21679.95010405750.000 r =6 0 77311.8 77311.80010483070.000 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 69089 944.3 4917605.000 4917605.000 r =5 30892 21743.9 3848.791 4921454.000 r =6 19 77311.8 77273.810 4998728.000 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 49401 944.3 2486549.000 2486549.000 r =5 47129 21743.9 29636.050 2516185.000 r =6 3470 77311.8 70527.550 2586713.000 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 20034 944.3 385911.400 385911.400 r =5 65406 21743.9 87674.200 473585.600 r =6 14560 77311.8 50933.860 524519.400 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 4555 944.3 13806.130 13806.130 r =5 67140 21743.9 94776.270 108582.400 r =6 28305 77311.8 31064.690 139647.100 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 4328 944.3 12124.750 12124.750 r =5 66706 21743.9 92972.760 105097.500 r =6 28966 77311.8 30232.340 135329.800 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 3825 944.3 8787.900 8787.900 r =5 62389 21743.9 75976.440 84764.340 r =6 33786 77311.8 24504.610 109268.900 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 9312 944.3 74148.350 74148.350 r =5 42836 21743.9 20459.840 94608.190 r =6 47852 77311.8 11225.710 105833.900 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 5514 944.3 22113.860 22113.860 r =5 42087 21743.9 19032.540 41146.400 r =6 52399 77311.8 8027.854 49174.250 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 822 944.3 15.840 15.840 r =5 39511 21743.9 14517.630 14533.470 r =6 59667 77311.8 4027.058 18560.530 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 2107 944.3 1431.607 1431.607 r =5 44312 21743.9 23423.540 24855.150 r =6 53581 77311.8 7284.154 32139.300 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 387 944.3 328.904 328.904 r =5 31150 21743.9 4068.944 4397.848 r =6 68463 77311.8 1012.799 5410.647 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 445 944.3 264.007 264.007 r =5 20356 21743.9 88.589 352.595 r =6 79199 77311.8 46.067 398.662 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 558 944.3 158.031 158.031 r =5 23940 21743.9 221.803 379.833 r =6 75502 77311.8 42.366 422.199 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 4180 944.3 11087.290 11087.290 r =5 21723 21743.9 .020 11087.320 r =6 74097 77311.8 133.679 11220.990 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 8033 944.3 53213.580 53213.580 r =5 22358 21743.9 17.344 53230.920 r =6 69609 77311.8 767.453 53998.380 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 14946 944.3 207611.300 207611.300 r =5 25365 21743.9 603.036 208214.300 r =6 59689 77311.8 4017.022 212231.300 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 18474 944.3 325415.600 325415.600 r =5 29741 21743.9 2941.220 328356.800 r =6 51785 77311.8 8428.438 336785.200 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 18932 944.3 342642.000 342642.000 r =5 31441 21743.9 4324.603 346966.600 r =6 49627 77311.8 9913.730 356880.300 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 4005 944.3 9920.433 9920.433 r =5 25115 21743.9 522.644 10443.080 r =6 70880 77311.8 535.081 10978.160 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 541 944.3 172.246 172.246 r =5 23280 21743.9 108.518 280.764 r =6 76179 77311.8 16.598 297.362 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 5332 944.3 20387.460 20387.460 r =5 39367 21743.9 14283.250 34670.710 r =6 55301 77311.8 6266.514 40937.220 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG BKGRBIN b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 8457 944.3 59769.740 59769.740 r =5 61567 21743.9 72934.450 132704.200 r =6 29976 77311.8 28982.360 161686.500 p=1-exp(-SUM/2)=1.00000 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 brank test summary for BKGRBIN The KS test for those 25 supposed UNI's yields KS p-value=1.000000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: THE BITSTREAM TEST :: :: The file under test is viewed as a stream of bits. Call them :: :: b1,b2,... . Consider an alphabet with two "letters", 0 and 1 :: :: and think of the stream of bits as a succession of 20-letter :: :: "words", overlapping. Thus the first word is b1b2...b20, the :: :: second is b2b3...b21, and so on. The bitstream test counts :: :: the number of missing 20-letter (20-bit) words in a string of :: :: 2^21 overlapping 20-letter words. There are 2^20 possible 20 :: :: letter words. For a truly random string of 2^21+19 bits, the :: :: number of missing words j should be (very close to) normally :: :: distributed with mean 141,909 and sigma 428. Thus :: :: (j-141909)/428 should be a standard normal variate (z score) :: :: that leads to a uniform [0,1) p value. The test is repeated :: :: twenty times. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: THE OVERLAPPING 20-tuples BITSTREAM TEST, 20 BITS PER WORD, N words This test uses N=2^21 and samples the bitstream 20 times. No. missing words should average 141909. with sigma=428. --------------------------------------------------------- tst no 1: 852168 missing words, 1659.48 sigmas from mean, p-value=1.00000 tst no 2: 850669 missing words, 1655.98 sigmas from mean, p-value=1.00000 tst no 3: 854549 missing words, 1665.05 sigmas from mean, p-value=1.00000 tst no 4: 850867 missing words, 1656.44 sigmas from mean, p-value=1.00000 tst no 5: 853877 missing words, 1663.48 sigmas from mean, p-value=1.00000 tst no 6: 855330 missing words, 1666.87 sigmas from mean, p-value=1.00000 tst no 7: 846521 missing words, 1646.29 sigmas from mean, p-value=1.00000 tst no 8: 843735 missing words, 1639.78 sigmas from mean, p-value=1.00000 tst no 9: 844915 missing words, 1642.54 sigmas from mean, p-value=1.00000 tst no 10: 850882 missing words, 1656.48 sigmas from mean, p-value=1.00000 tst no 11: 848839 missing words, 1651.70 sigmas from mean, p-value=1.00000 tst no 12: 848386 missing words, 1650.65 sigmas from mean, p-value=1.00000 tst no 13: 850510 missing words, 1655.61 sigmas from mean, p-value=1.00000 tst no 14: 850930 missing words, 1656.59 sigmas from mean, p-value=1.00000 tst no 15: 848633 missing words, 1651.22 sigmas from mean, p-value=1.00000 tst no 16: 851223 missing words, 1657.27 sigmas from mean, p-value=1.00000 tst no 17: 851889 missing words, 1658.83 sigmas from mean, p-value=1.00000 tst no 18: 860391 missing words, 1678.70 sigmas from mean, p-value=1.00000 tst no 19: 854954 missing words, 1665.99 sigmas from mean, p-value=1.00000 tst no 20: 852278 missing words, 1659.74 sigmas from mean, p-value=1.00000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: The tests OPSO, OQSO and DNA :: :: OPSO means Overlapping-Pairs-Sparse-Occupancy :: :: The OPSO test considers 2-letter words from an alphabet of :: :: 1024 letters. Each letter is determined by a specified ten :: :: bits from a 32-bit integer in the sequence to be tested. OPSO :: :: generates 2^21 (overlapping) 2-letter words (from 2^21+1 :: :: "keystrokes") and counts the number of missing words---that :: :: is 2-letter words which do not appear in the entire sequence. :: :: That count should be very close to normally distributed with :: :: mean 141,909, sigma 290. Thus (missingwrds-141909)/290 should :: :: be a standard normal variable. The OPSO test takes 32 bits at :: :: a time from the test file and uses a designated set of ten :: :: consecutive bits. It then restarts the file for the next de- :: :: signated 10 bits, and so on. :: :: :: :: OQSO means Overlapping-Quadruples-Sparse-Occupancy :: :: The test OQSO is similar, except that it considers 4-letter :: :: words from an alphabet of 32 letters, each letter determined :: :: by a designated string of 5 consecutive bits from the test :: :: file, elements of which are assumed 32-bit random integers. :: :: The mean number of missing words in a sequence of 2^21 four- :: :: letter words, (2^21+3 "keystrokes"), is again 141909, with :: :: sigma = 295. The mean is based on theory; sigma comes from :: :: extensive simulation. :: :: :: :: The DNA test considers an alphabet of 4 letters:: C,G,A,T,:: :: determined by two designated bits in the sequence of random :: :: integers being tested. It considers 10-letter words, so that :: :: as in OPSO and OQSO, there are 2^20 possible words, and the :: :: mean number of missing words from a string of 2^21 (over- :: :: lapping) 10-letter words (2^21+9 "keystrokes") is 141909. :: :: The standard deviation sigma=339 was determined as for OQSO :: :: by simulation. (Sigma for OPSO, 290, is the true value (to :: :: three places), not determined by simulation. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: OPSO test for generator BKGRBIN Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for BKGRBIN using bits 23 to 32 1018438******* 1.0000 OPSO for BKGRBIN using bits 22 to 31 1002102******* 1.0000 OPSO for BKGRBIN using bits 21 to 30 987343******* 1.0000 OPSO for BKGRBIN using bits 20 to 29 988238******* 1.0000 OPSO for BKGRBIN using bits 19 to 28 987646******* 1.0000 OPSO for BKGRBIN using bits 18 to 27 992072******* 1.0000 OPSO for BKGRBIN using bits 17 to 26 995296******* 1.0000 OPSO for BKGRBIN using bits 16 to 25 992965******* 1.0000 OPSO for BKGRBIN using bits 15 to 24 989454******* 1.0000 OPSO for BKGRBIN using bits 14 to 23 980454******* 1.0000 OPSO for BKGRBIN using bits 13 to 22 963125******* 1.0000 OPSO for BKGRBIN using bits 12 to 21 936347******* 1.0000 OPSO for BKGRBIN using bits 11 to 20 875113******* 1.0000 OPSO for BKGRBIN using bits 10 to 19 813470******* 1.0000 OPSO for BKGRBIN using bits 9 to 18 799329******* 1.0000 OPSO for BKGRBIN using bits 8 to 17 774509******* 1.0000 OPSO for BKGRBIN using bits 7 to 16 853703******* 1.0000 OPSO for BKGRBIN using bits 6 to 15 969942******* 1.0000 OPSO for BKGRBIN using bits 5 to 14 1022586******* 1.0000 OPSO for BKGRBIN using bits 4 to 13 1039842******* 1.0000 OPSO for BKGRBIN using bits 3 to 12 1045149******* 1.0000 OPSO for BKGRBIN using bits 2 to 11 1046875******* 1.0000 OPSO for BKGRBIN using bits 1 to 10 1047587******* 1.0000 OQSO test for generator BKGRBIN Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for BKGRBIN using bits 28 to 32 1042602******* 1.0000 OQSO for BKGRBIN using bits 27 to 31 1018663******* 1.0000 OQSO for BKGRBIN using bits 26 to 30 973772******* 1.0000 OQSO for BKGRBIN using bits 25 to 29 983315******* 1.0000 OQSO for BKGRBIN using bits 24 to 28 989721******* 1.0000 OQSO for BKGRBIN using bits 23 to 27 991274******* 1.0000 OQSO for BKGRBIN using bits 22 to 26 998994******* 1.0000 OQSO for BKGRBIN using bits 21 to 25 1009437******* 1.0000 OQSO for BKGRBIN using bits 20 to 24 1016781******* 1.0000 OQSO for BKGRBIN using bits 19 to 23 1018884******* 1.0000 OQSO for BKGRBIN using bits 18 to 22 1021797******* 1.0000 OQSO for BKGRBIN using bits 17 to 21 1018319******* 1.0000 OQSO for BKGRBIN using bits 16 to 20 1001056******* 1.0000 OQSO for BKGRBIN using bits 15 to 19 971702******* 1.0000 OQSO for BKGRBIN using bits 14 to 18 909198******* 1.0000 OQSO for BKGRBIN using bits 13 to 17 744835******* 1.0000 OQSO for BKGRBIN using bits 12 to 16 706756******* 1.0000 OQSO for BKGRBIN using bits 11 to 15 716040******* 1.0000 OQSO for BKGRBIN using bits 10 to 14 731377******* 1.0000 OQSO for BKGRBIN using bits 9 to 13 835614******* 1.0000 OQSO for BKGRBIN using bits 8 to 12 955932******* 1.0000 OQSO for BKGRBIN using bits 7 to 11 1012080******* 1.0000 OQSO for BKGRBIN using bits 6 to 10 1039302******* 1.0000 OQSO for BKGRBIN using bits 5 to 9 1045939******* 1.0000 OQSO for BKGRBIN using bits 4 to 8 1047523******* 1.0000 OQSO for BKGRBIN using bits 3 to 7 1048184******* 1.0000 OQSO for BKGRBIN using bits 2 to 6 1048463******* 1.0000 OQSO for BKGRBIN using bits 1 to 5 1048515******* 1.0000 DNA test for generator BKGRBIN Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for BKGRBIN using bits 31 to 32 1048545******* 1.0000 DNA for BKGRBIN using bits 30 to 31 1045655******* 1.0000 DNA for BKGRBIN using bits 29 to 30 905375******* 1.0000 DNA for BKGRBIN using bits 28 to 29 916319******* 1.0000 DNA for BKGRBIN using bits 27 to 28 972960******* 1.0000 DNA for BKGRBIN using bits 26 to 27 967155******* 1.0000 DNA for BKGRBIN using bits 25 to 26 973510******* 1.0000 DNA for BKGRBIN using bits 24 to 25 1015429******* 1.0000 DNA for BKGRBIN using bits 23 to 24 1030175******* 1.0000 DNA for BKGRBIN using bits 22 to 23 1033011******* 1.0000 DNA for BKGRBIN using bits 21 to 22 1034601******* 1.0000 DNA for BKGRBIN using bits 20 to 21 1035789******* 1.0000 DNA for BKGRBIN using bits 19 to 20 1036594******* 1.0000 DNA for BKGRBIN using bits 18 to 19 1035625******* 1.0000 DNA for BKGRBIN using bits 17 to 18 1036934******* 1.0000 DNA for BKGRBIN using bits 16 to 17 953081******* 1.0000 DNA for BKGRBIN using bits 15 to 16 812208******* 1.0000 DNA for BKGRBIN using bits 14 to 15 803476******* 1.0000 DNA for BKGRBIN using bits 13 to 14 816965******* 1.0000 DNA for BKGRBIN using bits 12 to 13 821166******* 1.0000 DNA for BKGRBIN using bits 11 to 12 838571******* 1.0000 DNA for BKGRBIN using bits 10 to 11 875962******* 1.0000 DNA for BKGRBIN using bits 9 to 10 965799******* 1.0000 DNA for BKGRBIN using bits 8 to 9 1026843******* 1.0000 DNA for BKGRBIN using bits 7 to 8 1040684******* 1.0000 DNA for BKGRBIN using bits 6 to 7 1047424******* 1.0000 DNA for BKGRBIN using bits 5 to 6 1048545******* 1.0000 DNA for BKGRBIN using bits 4 to 5 1048545******* 1.0000 DNA for BKGRBIN using bits 3 to 4 1048545******* 1.0000 DNA for BKGRBIN using bits 2 to 3 1048545******* 1.0000 DNA for BKGRBIN using bits 1 to 2 1048565******* 1.0000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the COUNT-THE-1's TEST on a stream of bytes. :: :: Consider the file under test as a stream of bytes (four per :: :: 32 bit integer). Each byte can contain from 0 to 8 1's, :: :: with probabilities 1,8,28,56,70,56,28,8,1 over 256. Now let :: :: the stream of bytes provide a string of overlapping 5-letter :: :: words, each "letter" taking values A,B,C,D,E. The letters are :: :: determined by the number of 1's in a byte:: 0,1,or 2 yield A,:: :: 3 yields B, 4 yields C, 5 yields D and 6,7 or 8 yield E. Thus :: :: we have a monkey at a typewriter hitting five keys with vari- :: :: ous probabilities (37,56,70,56,37 over 256). There are 5^5 :: :: possible 5-letter words, and from a string of 256,000 (over- :: :: lapping) 5-letter words, counts are made on the frequencies :: :: for each word. The quadratic form in the weak inverse of :: :: the covariance matrix of the cell counts provides a chisquare :: :: test:: Q5-Q4, the difference of the naive Pearson sums of :: :: (OBS-EXP)^2/EXP on counts for 5- and 4-letter cell counts. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Test results for BKGRBIN Chi-square with 5^5-5^4=2500 d.of f. for sample size:2560000 chisquare equiv normal p-value Results fo COUNT-THE-1's in successive bytes: byte stream for BKGRBIN *********1121637.000 1.000000 byte stream for BKGRBIN ********* 926880.400 1.000000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the COUNT-THE-1's TEST for specific bytes. :: :: Consider the file under test as a stream of 32-bit integers. :: :: From each integer, a specific byte is chosen , say the left- :: :: most:: bits 1 to 8. Each byte can contain from 0 to 8 1's, :: :: with probabilitie 1,8,28,56,70,56,28,8,1 over 256. Now let :: :: the specified bytes from successive integers provide a string :: :: of (overlapping) 5-letter words, each "letter" taking values :: :: A,B,C,D,E. The letters are determined by the number of 1's, :: :: in that byte:: 0,1,or 2 ---> A, 3 ---> B, 4 ---> C, 5 ---> D,:: :: and 6,7 or 8 ---> E. Thus we have a monkey at a typewriter :: :: hitting five keys with with various probabilities:: 37,56,70,:: :: 56,37 over 256. There are 5^5 possible 5-letter words, and :: :: from a string of 256,000 (overlapping) 5-letter words, counts :: :: are made on the frequencies for each word. The quadratic form :: :: in the weak inverse of the covariance matrix of the cell :: :: counts provides a chisquare test:: Q5-Q4, the difference of :: :: the naive Pearson sums of (OBS-EXP)^2/EXP on counts for 5- :: :: and 4-letter cell counts. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Chi-square with 5^5-5^4=2500 d.of f. for sample size: 256000 chisquare equiv normal p value Results for COUNT-THE-1's in specified bytes: bits 1 to 8******************** 1.000000 bits 2 to 9******************** 1.000000 bits 3 to 10******************** 1.000000 bits 4 to 11*********1592791.000 1.000000 bits 5 to 12********* 422227.900 1.000000 bits 6 to 13********* 234352.800 1.000000 bits 7 to 14********* 177638.400 1.000000 bits 8 to 15********* 186138.500 1.000000 bits 9 to 16********* 152470.100 1.000000 bits 10 to 17********* 170020.500 1.000000 bits 11 to 18********* 235947.900 1.000000 bits 12 to 19********* 278371.800 1.000000 bits 13 to 20********* 279823.400 1.000000 bits 14 to 21********* 182333.700 1.000000 bits 15 to 22********* 182193.400 1.000000 bits 16 to 23********* 199772.100 1.000000 bits 17 to 24********* 261441.400 1.000000 bits 18 to 25********* 238039.600 1.000000 bits 19 to 26********* 262506.300 1.000000 bits 20 to 27********* 227290.500 1.000000 bits 21 to 28********* 219670.200 1.000000 bits 22 to 29********* 228664.100 1.000000 bits 23 to 30********* 223312.600 1.000000 bits 24 to 31********* 226150.900 1.000000 bits 25 to 32********* 317977.800 1.000000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: THIS IS A PARKING LOT TEST :: :: In a square of side 100, randomly "park" a car---a circle of :: :: radius 1. Then try to park a 2nd, a 3rd, and so on, each :: :: time parking "by ear". That is, if an attempt to park a car :: :: causes a crash with one already parked, try again at a new :: :: random location. (To avoid path problems, consider parking :: :: helicopters rather than cars.) Each attempt leads to either :: :: a crash or a success, the latter followed by an increment to :: :: the list of cars already parked. If we plot n: the number of :: :: attempts, versus k:: the number successfully parked, we get a:: :: curve that should be similar to those provided by a perfect :: :: random number generator. Theory for the behavior of such a :: :: random curve seems beyond reach, and as graphics displays are :: :: not available for this battery of tests, a simple characteriz :: :: ation of the random experiment is used: k, the number of cars :: :: successfully parked after n=12,000 attempts. Simulation shows :: :: that k should average 3523 with sigma 21.9 and is very close :: :: to normally distributed. Thus (k-3523)/21.9 should be a st- :: :: andard normal variable, which, converted to a uniform varia- :: :: ble, provides input to a KSTEST based on a sample of 10. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: CDPARK: result of ten tests on file BKGRBIN Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 4 z-score:******* p-value: .000000 Successes: 6 z-score:******* p-value: .000000 Successes: 3 z-score:******* p-value: .000000 Successes: 7 z-score:******* p-value: .000000 Successes: 9 z-score:******* p-value: .000000 Successes: 6 z-score:******* p-value: .000000 Successes: 7 z-score:******* p-value: .000000 Successes: 6 z-score:******* p-value: .000000 Successes: 9 z-score:******* p-value: .000000 Successes: 5 z-score:******* p-value: .000000 square size avg. no. parked sample sigma 100. 6.200 1.833 KSTEST for the above 10: p= 1.000000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: THE MINIMUM DISTANCE TEST :: :: It does this 100 times:: choose n=8000 random points in a :: :: square of side 10000. Find d, the minimum distance between :: :: the (n^2-n)/2 pairs of points. If the points are truly inde- :: :: pendent uniform, then d^2, the square of the minimum distance :: :: should be (very close to) exponentially distributed with mean :: :: .995 . Thus 1-exp(-d^2/.995) should be uniform on [0,1) and :: :: a KSTEST on the resulting 100 values serves as a test of uni- :: :: formity for random points in the square. Test numbers=0 mod 5 :: :: are printed but the KSTEST is based on the full set of 100 :: :: random choices of 8000 points in the 10000x10000 square. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: This is the MINIMUM DISTANCE test for random integers in the file BKGRBIN Sample no. d^2 avg equiv uni 5 .0000 .0000 .000000 10 .0000 .0000 .000000 15 .0000 .0000 .000000 20 .0000 .0000 .000000 25 .0000 .0000 .000000 30 .0000 .0000 .000000 35 .0000 .0000 .000000 40 .0000 .0000 .000000 45 .0000 .0000 .000000 50 .0000 .0000 .000000 55 .0000 .0000 .000000 60 .0000 .0000 .000000 65 .0000 .0000 .000000 70 .0000 .0000 .000000 75 .0000 .0000 .000000 80 .0000 .0000 .000000 85 .0000 .0000 .000000 90 .0000 .0000 .000000 95 .0000 .0000 .000000 100 .0000 .0000 .000000 MINIMUM DISTANCE TEST for BKGRBIN Result of KS test on 20 transformed mindist^2's: p-value=1.000000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: THE 3DSPHERES TEST :: :: Choose 4000 random points in a cube of edge 1000. At each :: :: point, center a sphere large enough to reach the next closest :: :: point. Then the volume of the smallest such sphere is (very :: :: close to) exponentially distributed with mean 120pi/3. Thus :: :: the radius cubed is exponential with mean 30. (The mean is :: :: obtained by extensive simulation). The 3DSPHERES test gener- :: :: ates 4000 such spheres 20 times. Each min radius cubed leads :: :: to a uniform variable by means of 1-exp(-r^3/30.), then a :: :: KSTEST is done on the 20 p-values. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: The 3DSPHERES test for file BKGRBIN sample no: 1 r^3= .000 p-value= .00000 sample no: 2 r^3= .000 p-value= .00000 sample no: 3 r^3= .000 p-value= .00000 sample no: 4 r^3= .000 p-value= .00000 sample no: 5 r^3= .000 p-value= .00000 sample no: 6 r^3= .000 p-value= .00000 sample no: 7 r^3= .000 p-value= .00000 sample no: 8 r^3= .000 p-value= .00000 sample no: 9 r^3= .000 p-value= .00000 sample no: 10 r^3= .000 p-value= .00000 sample no: 11 r^3= .000 p-value= .00000 sample no: 12 r^3= .000 p-value= .00000 sample no: 13 r^3= .000 p-value= .00000 sample no: 14 r^3= .000 p-value= .00000 sample no: 15 r^3= .000 p-value= .00000 sample no: 16 r^3= .000 p-value= .00000 sample no: 17 r^3= .000 p-value= .00000 sample no: 18 r^3= .000 p-value= .00000 sample no: 19 r^3= .000 p-value= .00000 sample no: 20 r^3= .000 p-value= .00000 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file BKGRBIN p-value=1.000000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the SQEEZE test :: :: Random integers are floated to get uniforms on [0,1). Start- :: :: ing with k=2^31=2147483647, the test finds j, the number of :: :: iterations necessary to reduce k to 1, using the reduction :: :: k=ceiling(k*U), with U provided by floating integers from :: :: the file being tested. Such j's are found 100,000 times, :: :: then counts for the number of times j was <=6,7,...,47,>=48 :: :: are used to provide a chi-square test for cell frequencies. :: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::